﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Semantics;
namespace SilverlightParser.Web.Backend
{
    class Reference
    {
        static bool NLPInitialized = false;
        public static void InitializeNLP()
        {
            if (!NLPInitialized)
            {
                NLPInitialized = true;
                NLP.Initialize();
                NLP.Dictionary.InsertWord("与时俱进", "变动");
            }
        }

        public static Market GetMarket(System.Web.HttpApplicationState Application)
        {
            object o = Application["Market"];
            if (o == null)
            {
                Market market = new Market();
                Application["Market"] = market;
                return market;
            }
            else
                return (Market)o;
        }

        static RemotableMentorProxy mentorproxy;
        public static RemotableMentorProxy RemotableMentorProxy
        {
            get
            {
                if (mentorproxy == null)
                {
                    mentorproxy = new RemotableMentorProxy();
                }
                return mentorproxy;
            }
        }
        static SortedList<string, RemotableDialogueProxy> proxies = new SortedList<string, RemotableDialogueProxy>();
        public static RemotableDialogueProxy GetDialogueProxy(string contact)
        {
            RemotableDialogueProxy proxy;
            if (proxies.TryGetValue(contact, out proxy))
                return proxy;
            proxy = new RemotableDialogueProxy(contact);
            proxies.Add(contact, proxy);
            return proxy;
        }
    }
}
